<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http:www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<include file="./Home/Tpl/Admin/Common/cssjs.html" />
</head>
<body>
<div class="subnav">
  <div class="content-menu ib-a blue line-x"> 
  <a class="add fb" href="{:U("Index/add")}"><em>添加模型</em></a>　 
  <a href='javascript:;' class="on"><em>模型管理</em></a>
  </div>
</div>
<style type="text/css">
	html{_overflow-y:scroll}
</style>
<div class="pad-lr-10">
<div class="table-list">
  <table width="100%" cellspacing="0" >
    <thead>
      <tr>
        <th width="100">modelid</th>
        <th width="100">模型名称</th>
        <th width="100">数据表</th>
        <th >描述</th>
        <th width="100">状态</th>
        <th width="230">管理操作</th>
      </tr>
    </thead>
    <tbody>
    <volist name="data" id="vo">
      <tr>
        <td align='center'>{$vo.modelid}</td>
        <td align='center'>{$vo.name}</td>
        <td align='center'>{$vo.tablename}</td>
        <td align='center'>{$vo.description}</td>
        <td align='center'><font color="red"><if condition="$vo['disabled'] eq '1' ">╳<else />√</if></font></td>
        <td align='center'><a href="{:U('Models/Sitemodel_field/index',array('modelid'=>$vo['modelid']))}">字段管理</a> | <a href="{:U("Index/edit",array("modelid"=>$vo['modelid']))}">修改</a> | 
        <if condition=" $vo['disabled'] eq 0 ">
        <a href="{:U("Index/disabled",array("modelid"=>$vo['modelid'],"disabled"=>0))}">禁用</a> | 
        <else />
        <a href="{:U("Index/disabled",array("modelid"=>$vo['modelid'],"disabled"=>1))}"><font color="#FF0000">启用</font></a> | 
        </if>
        <a href="javascript:;" onClick="model_delete(this,'{$vo.modelid}','确认要删除 『 {$vo.name} 』 吗？删除后，数据表将同时被删除！',0)">删除</a> </td>
      </tr>
    </volist>
    </tbody>
  </table>
  <div id="pages"> </div>
</div>
<script type="text/javascript">
function model_delete(obj, id, name, items) {
    if (items) {
        alert('该模型下已经有内容，不能删除');
        return false;
    }
    art.dialog.through({
        content: name,
        fixed: true,
        style: 'confirm',
        id: 'model_delete'
    }, function () {
        $.get('?g=Models&m=Index&a=delete&modelid=' + id + '', function (data) {
            if (data.status) {
                $(obj).parent().parent().fadeOut("slow");
            }else{
				art.dialog.alert(data.info);
			}
        },"json")
    });
};
</script>
</body>
</html>